var initialState = {
  counter: 0,
  counter1: 0,
  lists: {}
};
// reudcer的处理只能使用纯函数
export const counter = (state = initialState, action) => {
  switch (action.type) {
    case 'INCREASE':
      // 我哪知道哪些是纯函数？ ---> 将原来的对象复制成一个新对象，我直接操作新对象，旧对象改变不改变？
      //   return Object.assign({}, state, { counter: state.counter + 1 });
      return { ...state, counter: state.counter + 1 };

    //   return { counter: state.counter + 1 };
    case 'DECREASE':
      //   return Object.assign({}, state, { counter1: state.counter1 - 1 });
      return { ...state, counter1: state.counter1 - 1 };
    //   return { counter1: state.counter1 - 1 };
    case 'GETLISTS':
      return Object.assign({}, state, { lists: action.payload });
    default:
      return state;
  }
}


